////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (c) 2010 Leon Coto Rodriguez
//  leoncoto@gmail.com
//  
//  Permission is hereby granted, free of charge, to any person
//  obtaining a copy of this software and associated documentation
//  files (the "Software"), to deal in the Software without
//  restriction, including without limitation the rights to use,
//  copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the
//  Software is furnished to do so, subject to the following
//  conditions:
//  
//   The above copyright notice and this permission notice shall be
//   included in all copies or substantial portions of the Software.
//  
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
//  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
//  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
//  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
//  OTHER DEALINGS IN THE SOFTWARE.
//
////////////////////////////////////////////////////////////////////////////////

package org.flexspeedup.services 
{

import mx.core.IMXMLObject;
import mx.rpc.AsyncToken;
import mx.rpc.mxml.IMXMLSupport;

/**
 * Implementing this interface means that a service is capable of creating 
 * collection items and manage them.
 * 
 * @langversion 3.0
 * @playerversion Flash 9
 * @playerversion AIR 1.1
 * @productversion Flex 3
 */
public interface ICollectionService extends IMXMLObject, IMXMLSupport
{
    /**
     * Creates a new item in the collectiond
     * 
     * @param item The item to add into the collection
     * 
     * @return AsyncToken Call using the asynchronous completion token pattern.
     * The same object is available in the <code>result</code> and
     * <code>fault</code> events from the <code>token</code> property.
     * 
     * @langversion 3.0
     * @playerversion Flash 9
     * @playerversion AIR 1.1
     * @productversion Flex 3
     */
    function createItem(item:*):AsyncToken;

    /**
     * Updates an existing item in the collection
     * 
     * @param item The item update in the collection
     * 
     * @return AsyncToken Call using the asynchronous completion token pattern.
     * The same object is available in the <code>result</code> and
     * <code>fault</code> events from the <code>token</code> property.
     * 
     * @langversion 3.0
     * @playerversion Flash 9
     * @playerversion AIR 1.1
     * @productversion Flex 3
     */
    function updateItem(item:*):AsyncToken;

    /**
     * Retrieves a sub set of data from a remote data collection.
     * 
     * @param pageNumber The page to be fetched from the remote data collection.
     * 
     * @param pageSize The maximum amount of items to fetch
     * 
     * @return AsyncToken Call using the asynchronous completion token pattern.
     * The same object is available in the <code>result</code> and
     * <code>fault</code> events from the <code>token</code> property.
     * 
     * @langversion 3.0
     * @playerversion Flash 9
     * @playerversion AIR 1.1
     * @productversion Flex 3
     */
    function fetchResultSet(pageNumber:int, pageSize:int):AsyncToken;
}
}